package com.hunttown.common.sharding.client;

import java.util.HashMap;
import java.util.Map;

public class RouteFactor {
    private String logicalTableName;
    private String action;
    private Object parameter;
    private Map<String, Object> routeFields = null;

    public RouteFactor(String logicalTableName) {
        this.logicalTableName = logicalTableName;
    }

    public RouteFactor(String statementName, Object parameterObj) {
        this.setAction(statementName);
        this.setParameter(parameterObj);
    }

    public String getLogicalTableName() {
        return this.logicalTableName;
    }

    public RouteFactor addRouteField(String routeFieldKey, Object routeFieldValue) {
        if (this.routeFields == null) {
            this.routeFields = new HashMap(1);
        }

        this.routeFields.put(routeFieldKey, routeFieldValue);
        return this;
    }

    public Object getRouteField(String routeFieldKey) {
        return this.routeFields != null ? this.routeFields.get(routeFieldKey) : null;
    }

    public Object getParameter() {
        return this.parameter;
    }

    public void setParameter(Object parameter) {
        this.parameter = parameter;
    }

    public String getAction() {
        return this.action;
    }

    public void setAction(String action) {
        this.action = action;
    }
}
